﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Threading;
using System.Globalization;
using System.Data;


using System.Web.UI.WebControls.WebParts;
using System.Web.UI.HtmlControls;

public partial class admin_MasterPage : System.Web.UI.MasterPage
{
    private string titleName = "Công Ty TNHH Công Nghệ Thông Tin ITON";
    protected void Page_Load(object sender, EventArgs e)
    {
        //if (Session["title"] != null)
        //    title.Text = Session["title"].ToString();
        //else
        //    title.Text = titleName;
        if (!this.IsPostBack)
        {
           

            LoadLoaiSanPham();
        }

    }

    private void LoadLoaiSanPham()
    {
        repListCha.DataSource = new LoaiSanPhamHelper().LoadLoaiSanPhamGoc();
        repListCha.DataBind();
    }

    protected void repListCha_OnItemDataBound(object sender, RepeaterItemEventArgs e)
    {
        if (e.Item.ItemType == ListItemType.Item || e.Item.ItemType == ListItemType.AlternatingItem)
        {
            LoaiSanPhamHelper lspHP = new LoaiSanPhamHelper();
            Repeater repCon = ((Repeater)e.Item.FindControl("repCon"));
            repCon.DataSource = (lspHP.LoadLoaiSanPhamCon(Convert.ToInt32((((DataRowView)e.Item.DataItem)["LoaiSanPhamID"]))));
            repCon.DataBind();
        }
    }

    protected void repCon_OnItemDataBound(object sender, RepeaterItemEventArgs e)
    {
        if (e.Item.ItemType == ListItemType.Item || e.Item.ItemType == ListItemType.AlternatingItem)
        {
            LoaiSanPhamHelper lspHP = new LoaiSanPhamHelper();
            Repeater repCon = ((Repeater)e.Item.FindControl("repCon"));
            repCon.DataSource = (lspHP.LoadLoaiSanPhamCon(Convert.ToInt32((((DataRowView)e.Item.DataItem)["LoaiSanPhamID"]))));
            repCon.DataBind();
        }
    }
}
